from typing import Optional,List
from datetime import datetime
from uuid import UUID
from pydantic import BaseModel, EmailStr, AnyHttpUrl, validator, Field 
from core.schemas.base import BaseResponse

class reservationItem(BaseModel):
    classroomId:int
    index:str
    reservationTime:List[str]
    def get_times_as_datetimes(self):
        # 使用 strptime 解析特定格式的时间字符串
        return [datetime.strptime(time_str, "%Y-%m-%d %H:%M:%S") for time_str in self.reservationTime]

class CourseCreate(BaseModel):
    name : str
    class_id : int
    times:int
    reservation :List[reservationItem]
   
